--[[ 编码: WMS-38-20 名称: 任务-立库出库搬运-是否可推送 日期:2025-1-29 作者:HAN 入口函数: Push 功能说明: 是否可推送任务根据每个项目的情况不同改进这里的代码,例子脚本来源巨星二期料箱库 立库调度在巨星二期这个项目中只会出现在立库出库作业 因此需要判断1楼东西,1.5楼,2,3楼分拣位的任务数量是否允许推送 变更记录: --]] wms_task = require( "wms_task" ) function CanPush ( strLuaDEID ) local strCondition local nRet, strRetInfo local task -- step1: 获取需要推送的任务对象 nRet, task = m3.GetSysCurEditDataObj( strLuaDEID, "Task" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetSysCurEditDataObj 失败!"..task ) end -- step2: 获取任务目的地未完成任务数量 1-- 已推送 2 -- 执行中 strCondition = "S_END_LOC = '"..task.end_loc_code.."' AND ( N_B_STATE = 1 OR N_B_STATE = 2 )" nRet, strRetInfo = mobox.getDataObjCount( strLuaDEID, "Task", strCondition ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "getDataObjCount 失败!"..strRetInfo ) end local nCount = tonumber( strRetInfo ) -- step3 获取目标货位的最大容器数量 local loc nRet, loc = wms_wh.GetLocInfo( task.end_loc_code ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "wms_wh.GetLocInfo 失败!"..loc ) end local nMaxCount = loc.capacity -- 这些出库站台的货位都要设置 capacity ,目前=5,可以调整 local strResult = 'yes' if ( nCount >= nMaxCount ) then strResult = "no" end -- 把检测结果返回给 服务器端 -- 0 说明返回的是字符串 1 是JSON mobox.returnValue( strLuaDEID, 0, strResult ) end